package com.steel.yfmall.cloud.assistant;

import com.alibaba.fastjson.JSON;
import com.steel.yfmall.cloud.assistant.api.stock.AssistantToZgServiceAPI;
import com.steel.yfmall.cloud.assistant.api.stock.ZgOrderService;
import com.steel.yfmall.cloud.assistant.bean.ResponseZgMsgBean;
import com.steel.yfmall.cloud.assistant.bean.param.APIParamCompanyAddressBean;
import com.steel.yfmall.cloud.assistant.bean.param.ZgOrderParamBean;
import com.steel.yfmall.cloud.assistant.bean.param.zg.APIParaWarrantyBean;
import com.steel.yfmall.cloud.assistant.bean.param.zg.APIZgChangerOrderBean;
import com.steel.yfmall.cloud.assistant.bean.result.APIResultWarrantyBean;
import com.steel.yfmall.cloud.assistant.view.WarrantyService;
import com.steel.yfmall.cloud.components.utils.base.APIMsgBean;
import com.steel.yfmall.cloud.components.utils.base.Pages;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;

/**
 * @author yuchaohua
 * @version V1.0
 * @Title: zg
 * @Package com.steel.yfmall.cloud.assistant
 * @Description: (用一句话描述该文件做什么)
 * @date 2020/12/9 16:19
 */
@Slf4j
@SpringBootTest
@RunWith(SpringRunner.class)
public class ZgTestClass {

    @Resource
    private AssistantToZgServiceAPI assistantToZgServiceAPI;

    /**
     * 同步收货地址
     */
    @Test
    public void testTemplateCompanyAddress() {
        APIParamCompanyAddressBean masterOrderInfo = new APIParamCompanyAddressBean();
        masterOrderInfo.setAddressId(335413);
        APIMsgBean<Boolean> resultBean = assistantToZgServiceAPI.templateCompanyAddress(masterOrderInfo);
        System.out.println("-------------------------------------");
        System.out.println(JSON.toJSONString(resultBean));
        System.out.println("-------------------------------------");
    }


    @Test
    public void testProductionOrderChange() {
        String paramStr = "{\"CHANGENO\":\"\",\"DETAILS\":[{\"ADDVERDATE\":\"20210107\",\"ADDVEREMPNO\":\"031010\",\"ADDVERTIME\":\"140616\",\"APNNO\":\"HY04\",\"AREANO\":\"01\",\"AREANOR\":\"\",\"BASEPRICE\":\"4120\",\"BASEPRICESYS\":\"0\",\"BEGINLOCNO\":\"05000004\",\"BEGINLOCNOR\":\"\",\"BUNDLEQTY\":\"0\",\"BUNDLEREQ\":\"\",\"CANCELCLOSEDATE\":\"\",\"CANCELCLOSEEMPNO\":\"\",\"CANCELCLOSETIME\":\"\",\"CANCELDATE\":\"\",\"CANCELEMPNO\":\"\",\"CANCELTIME\":\"\",\"CARKIND\":\"0\",\"CHGDELIQTY\":\"0\",\"CHGDELIWGT\":\"0\",\"CHGQTY\":\"0\",\"CHGWGT\":\"0\",\"CLOSEDATE\":\"\",\"CLOSEEMPNO\":\"\",\"CLOSEREASON\":\"\",\"CLOSETIME\":\"\",\"COILWGTMAX\":\"0\",\"COILWGTMIN\":\"0\",\"COMPID\":\"hbjyjt\",\"CONFIRMDATE\":\"20201224\",\"CONFIRMEMPNO\":\"langeQS\",\"CONFIRMTIME\":\"221218\",\"COUNTWGTMODE\":\"A\",\"CREATEDATE\":\"20201224\",\"CREATEEMPNO\":\"langeQS\",\"CREATETIME\":\"213716\",\"CUTEDGECODE\":\"\",\"DELETEDATE\":\"\",\"DELETEEMPNO\":\"\",\"DELETEREASON\":\"\",\"DELETETIME\":\"\",\"DELIAMT\":\"0\",\"DELIQTY\":\"0\",\"DELITRANSAMT\":\"0\",\"DELIWGT\":\"0\",\"DIAGONALTOLCODE\":\"\",\"DISPQTY\":\"0\",\"DISPWGT\":\"0\",\"DRAFTORDERITEM\":\"\",\"DRAFTORDERNO\":\"201224213714100070\",\"DSCOMVER\":\"\",\"ENDLOCNO\":\"07180002\",\"ENDLOCNOR\":\"\",\"ENGRAVEREQ\":\"\",\"EXCHARGEPRICE\":\"0\",\"FREIGHTPRICE\":\"81\",\"FREIGHTPRICEADJ\":\"0\",\"FREIGHTPRICENO\":\"T_N_20190326_000000_05000004_07180002__R_RRB_2_2__F\",\"FREIGHTPRICENOR\":\"\",\"FREIGHTPRICESYS\":\"81\",\"GOALCOILWGT\":\"0\",\"HARDNESSTOLCODE\":\"\",\"INNERDIATOLMAX\":\"0\",\"INNERDIATOLMIN\":\"0\",\"INSPECT\":\"\",\"INSPUNITCODE\":\"\",\"INSTALLATIONCOST\":\"0\",\"ISCUSTOMIZE\":\"\",\"ISCUTEDGE\":\"N\",\"ISMERGE\":\"N\",\"ISRAISEPRICE\":\"N\",\"LABELREQ\":\"\",\"LABELTRADENO\":\"\",\"LENGTHTOLCODE\":\"\",\"LINEUPSTATUS\":\"S\",\"LOADWGTKIND\":\"2\",\"MEMO\":\"\",\"MODIFYVERDATE\":\"\",\"MODIFYVEREMPNO\":\"\",\"MODIFYVERTIME\":\"\",\"MSCNO\":\"A-R-GB-0027\",\"NEGDIFFERNCEMAX\":\"0\",\"NEGDIFFERNCEMIN\":\"0\",\"NORMALIZING\":\"\",\"OILTYPE\":\"\",\"OLDSYSORDERITEM\":\"\",\"ORDERFLENGTH\":\"0\",\"ORDERFTHICK\":\"0\",\"ORDERFWIDTH\":\"0\",\"ORDERINNERDIA\":\"762\",\"ORDERITEM\":\"001\",\"ORDERLENGTH\":\"12000\",\"ORDERLENGTHC\":\"\",\"ORDERLENGTHMAX\":\"12000\",\"ORDERLENGTHMIN\":\"12000\",\"ORDERNO\":\"NR201224013\",\"ORDEROUTERDIA\":\"0\",\"ORDERPRICE\":\"4120\",\"ORDERQTY\":\"1\",\"ORDERTHICK\":\"14\",\"ORDERTHICKC\":\"\",\"ORDERTHICKMAX\":\"0\",\"ORDERTHICKMIN\":\"0\",\"ORDERTHKBOUNS\":\"0\",\"ORDERVER\":\"02\",\"ORDERWGT\":\"2.9\",\"ORDERWIDTH\":\"0\",\"ORDERWIDTHC\":\"\",\"ORDERWIDTHMAX\":\"0\",\"ORDERWIDTHMIN\":\"0\",\"PACKCODE\":\"F\",\"PERFORMANCEFLAG\":\"\",\"PIECEWGT\":\"2.9\",\"PRICEVER\":\"\",\"PRINTSHIPTOL\":\"N\",\"PRIORITY\":\"N\",\"PROCESSCOST\":\"0\",\"PRODCLASS\":\"R\",\"PRODPRICE\":\"4120\",\"PRODTYPE\":\"RRB\",\"PSRNO\":\"RRB_HRB400E_001\",\"QUALITY\":\"1\",\"RAISEPRICEAMT\":\"0\",\"RAISEPRICELENGTH\":\"0\",\"RAISEPRICETHICK\":\"0\",\"RAISEPRICETRADENO\":\"\",\"REBATE\":\"N\",\"RECORDERNO\":\"031\",\"RECORDERNOR\":\"\",\"RELEASEAMT\":\"0\",\"RIBSHAPE\":\"\",\"SALEREVISENO\":\"\",\"SHIPREQDATE\":\"20201229\",\"SHIPTOLMAX\":\"10\",\"SHIPTOLMIN\":\"-10\",\"SITEKIND\":\"F\",\"SIZEMSG\":\"N\",\"SPECIALPRICEFLAG\":\"Y\",\"SPECMARK\":\"Φ14mm*12000mm\",\"STANDNAME\":\"GB/T 1499.2-2018\",\"STATUS\":\"19\",\"SURFACEQUALITY\":\"\",\"SURFACESTRUCTURE\":\"\",\"TEMPERING\":\"\",\"TENSILETOLCODE\":\"\",\"THICKTOLCODE\":\"\",\"TOLERANCETYPE\":\"N\",\"TOWERTOL\":\"0\",\"TRADENO\":\"HRB400E\",\"ULTRASONICTESTCODE\":\"\",\"ULTRASONICTESTLEVEL\":\"\",\"UNCLOSEDATE\":\"\",\"UNCLOSEEMPNO\":\"\",\"UNCLOSETIME\":\"\",\"UPDATEDATE\":\"20201224\",\"UPDATEEMPNO\":\"langeQS\",\"UPDATETIME\":\"221218\",\"WAREHOUSENO\":\"M200003\",\"WATERRATE\":\"0\",\"WIDTHTOLCODE\":\"\"}],\"FORMID\":\"SO04\",\"MAIN\":{\"ADDVERDATE\":\"20210107\",\"ADDVEREMPNO\":\"031010\",\"ADDVERTIME\":\"140616\",\"AFTERCHGTERM\":\"4\",\"ARBITRATIONLOCALITY\":\"\",\"AREANO\":\"01\",\"BATCHLIMIT\":\"\",\"BEFORECHGTERM\":\"2\",\"BEGINLOCNO\":\"05000004\",\"BEGINPORT\":\"\",\"BILLID\":\"\",\"BRUSHCOLORREQ\":\"\",\"CANCELDATE\":\"\",\"CANCELEMPNO\":\"\",\"CANCELTIME\":\"\",\"CARKIND\":\"0\",\"CASH\":\"1.1948\",\"CASHPAYDAYS\":\"2\",\"CERTIFYPOSTNO\":\"031\",\"CHANGEREASON\":\"1\",\"COMPID\":\"hbjyjt\",\"CONFIRMDATE\":\"20210107\",\"CONFIRMEMPNO\":\"031010\",\"CONFIRMTIME\":\"140647\",\"CONTRACTMONTH\":\"\",\"CONTRACTNO\":\"\",\"CONTRACTTYPEA\":\"C\",\"CONTRACTTYPEB\":\"I\",\"CONTRACTTYPEC\":\"N\",\"CONTRACTTYPED\":\"\",\"CONTRACTTYPEE\":\"B\",\"COSTCENTER\":\"\",\"CRCY\":\"CNY\",\"CREATEDATE\":\"20201224\",\"CREATEEMPNO\":\"langeQS\",\"CREATETIME\":\"213716\",\"CTCODEESA\":\"\",\"CUSTNO\":\"10309000076\",\"CUTPRICE\":\"0\",\"CUTPRICE2\":\"0\",\"DELIVERYAREA\":\"007\",\"DISCOUNTSPRICEA\":\"0\",\"DISCOUNTSPRICEB\":\"0\",\"DISCOUNTSPRICEC\":\"0\",\"DISCOUNTSQTYEA\":\"0\",\"DISCOUNTSQTYEB\":\"0\",\"DISCOUNTSQTYEC\":\"0\",\"DISCOUNTSQTYSA\":\"0\",\"DISCOUNTSQTYSB\":\"0\",\"DISCOUNTSQTYSC\":\"0\",\"DRAFTORDERNO\":\"201224213714100070\",\"DSCOMVER\":\"\",\"ENDLOCNO\":\"07180002\",\"ENDPORT\":\"\",\"EXCHANGERATE\":\"1\",\"FLOWCHARTURL\":\"\",\"FORCECONFIRM\":\"N\",\"FREIGHTAMT\":\"234.9\",\"FREIGHTFAVOURABLE\":\"0\",\"FREIGHTSETTLEMODE\":\"\",\"GUIDEPRICERATE\":\"0\",\"HOLIDAYGETPRICEMODE\":\"\",\"INSPECTIONCHARGE\":\"\",\"INSPECTIONLOCALITY\":\"\",\"INVPOSTNO\":\"031\",\"IRREVERSIBLEDAYS\":\"0\",\"ISECOMMERCE\":\"Y\",\"ISFUTURES\":\"N\",\"ISNOTEPRICE\":\"\",\"ISOUTFACTORYSHIP\":\"\",\"ISPRICEVERIFY\":\"N\",\"LOADWGTKIND\":\"2\",\"MILLCOPY\":\"1\",\"MINPRICEDAYS\":\"0\",\"MNRATE\":\"0\",\"MODIFYVERDATE\":\"20210107\",\"MODIFYVEREMPNO\":\"031010\",\"MODIFYVERTIME\":\"140647\",\"NATION\":\"\",\"NETPRICECOUNTMODE\":\"\",\"NETPRICEGROUP\":\"\",\"NONWORKDATEGETPRICEMODE\":\"\",\"OLDSYSORDERNO\":\"\",\"ONVERIFY\":\"N\",\"ORDERAMT\":\"11948\",\"ORDERDATE\":\"20201224\",\"ORDERNO\":\"NR201224013\",\"ORDERVALIDDATE\":\"20210124\",\"ORDERVER\":\"02\",\"ORDERWGT\":\"2.9\",\"OUTFACTORYDAYS\":\"0\",\"PAYAMTA\":\"0\",\"PAYAMTB\":\"0\",\"PAYAMTC\":\"0\",\"PAYAMTD\":\"0\",\"PAYDATEA\":\"\",\"PAYDATEB\":\"\",\"PAYDATEC\":\"\",\"PAYDATED\":\"\",\"PAYMENTCOLLECTDATE\":\"\",\"PAYMENTCOLLECTDAYS\":\"0\",\"PAYMENTFAVOURABLE\":\"0\",\"PAYMENTMETHOD\":\"F\",\"PAYMETHODA\":\"\",\"PAYMETHODB\":\"\",\"PAYMETHODC\":\"\",\"PAYMETHODD\":\"\",\"PAYRATEA\":\"0\",\"PAYRATEB\":\"0\",\"PAYRATEC\":\"0\",\"PAYRATED\":\"0\",\"PRICEFROMCONTRACT\":\"N\",\"PRICETYPE\":\"\",\"PRODAMT\":\"11948\",\"PRODCLASS\":\"R\",\"PRODTYPE\":\"\",\"PROJECTNO\":\"\",\"QUALITYDISCREPANCYDAYS\":\"0\",\"REBATETHISMONTH\":\"\",\"RECEIVEPAYMENTMETHOD\":\"A\",\"RECORDERNO\":\"031\",\"REMARK\":\"\",\"SALESAREA\":\"021\",\"SALESCUSTNO\":\"10309000076\",\"SALESDEPT\":\"01043403\",\"SALESGROUP\":\"021002\",\"SALESMAN\":\"031756\",\"SALESTYPE\":\"N\",\"SETTLEDATEF\":\"\",\"SETTLEDATES\":\"\",\"SETTLEDATETYPE\":\"\",\"SETTLEMODE\":\"L\",\"SETTLEMODECOUNTMODE\":\"\",\"SETTLETERM\":\"\",\"SHIPTOLMAX\":\"10\",\"SHIPTOLMIN\":\"-10\",\"SIGNEDCOMP\":\"0194\",\"SIGNEDSITE\":\"平山县南甸镇\",\"SITEKIND\":\"F\",\"STATUS\":\"19\",\"SUBACTFREIGHTPRICE\":\"\",\"SUBMITCOUNT\":\"1\",\"SUBMITDATE\":\"20201224\",\"SUBMITEMPNO\":\"langeQS\",\"SUBMITESACOUNT\":\"0\",\"SUBMITESADATE\":\"\",\"SUBMITESAEMPNO\":\"\",\"SUBMITESATIME\":\"\",\"SUBMITTIME\":\"213718\",\"TAXRATE\":\"16\",\"TAXTYPE\":\"D\",\"THIRDPARTYINSPECTION\":\"\",\"TRANSTOOLNO\":\"\",\"TRANSWAY\":\"D\",\"TRANSWAYNO\":\"T\",\"UNSUBMITDATE\":\"\",\"UNSUBMITEMPNO\":\"\",\"UNSUBMITESADATE\":\"\",\"UNSUBMITESAEMPNO\":\"\",\"UNSUBMITESATIME\":\"\",\"UNSUBMITTIME\":\"\",\"UPDATEDATE\":\"20201224\",\"UPDATEEMPNO\":\"langeQS\",\"UPDATETIME\":\"221218\",\"USETYPE\":\"\",\"VERIFYDATE\":\"20201224\",\"VERIFYEMPNO\":\"\",\"VERIFYREMARK\":\"\",\"VERIFYTIME\":\"213718\"},\"MSG\":\"\",\"ORDERNO\":\"NR201224013\",\"REASON\":\"1\"}";
        APIZgChangerOrderBean masterOrderInfo = new APIZgChangerOrderBean();
        masterOrderInfo = JSON.parseObject(paramStr,APIZgChangerOrderBean.class);
        ResponseZgMsgBean<String> resultBean = assistantToZgServiceAPI.productionOrderChange(masterOrderInfo);
        System.out.println("-------------------------------------");
        System.out.println(JSON.toJSONString(resultBean));
        System.out.println("-------------------------------------");
    }


    @Resource
    private ZgOrderService zgOrderService;


    @Test
    public void testAddZgOrderConfirm() {
        ZgOrderParamBean masterOrderInfo = new ZgOrderParamBean();
        masterOrderInfo.setMasterOrderSn("210125180546100187");
        APIMsgBean<Boolean> resultBean = zgOrderService.addZgOrderConfirm(masterOrderInfo);
        System.out.println("-------------------------------------");
        System.out.println(JSON.toJSONString(resultBean));
        System.out.println("-------------------------------------");
    }


    @Test
    public void testCannotZgOrder() {
        ZgOrderParamBean masterOrderInfo = new ZgOrderParamBean();
        masterOrderInfo.setMasterOrderSn("210120133831100145");
        APIMsgBean<Boolean> resultBean = zgOrderService.cannotZgOrder(masterOrderInfo);
        System.out.println("-------------------------------------");
        System.out.println(JSON.toJSONString(resultBean));
        System.out.println("-------------------------------------");
    }


    @Test
    public void getWarrantyService(){
        APIParaWarrantyBean apiParaBean = new APIParaWarrantyBean();
        apiParaBean.setCurrentPage(1);
//        apiParaBean.setCustomerNoList("10304000335,10200001577");
//        apiParaBean.setCustomerName("沧州");
//        apiParaBean.setShipDateStar("20180720");
        apiParaBean.setMillSheetNo("210220Z00122");
        APIMsgBean<Pages<APIResultWarrantyBean>> dataBean = warrantyService.getWarrantyFromZg(apiParaBean);
        System.out.println("结束-----------------------------------");
        System.out.println(JSON.toJSONString(dataBean));
        System.out.println("结束-----------------------------------");
    }

    @Resource
    private WarrantyService warrantyService;

}
